﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using Microsoft.Win32;
using AgentObjects;
using SimpleUtils;
using SimpleUtils.Win;

namespace SimpleReminder
{
    public partial class frmReminderApp : frmBase
    {
        public frmReminderApp()
        {
            InitializeComponent();

            DialogResult = DialogResult.Cancel;

            //EnableDisableAllButtons(false);
        }

        private void EnableDisableAllButtons(bool enabled)
        {
        //    btnTest.Enabled = enabled;
        }

        //private void frmDemo_FormClosing(object sender, FormClosingEventArgs e)
        //{
        //    try
        //    {
        //    }
        //    catch { }
        //}

        private void btnTest_Click(object sender, EventArgs e)
        {
            if(!String.IsNullOrEmpty(txtApp.Text))
                SimpleProcess.Start(txtApp.Text, txtArg.Text);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        public string AppPath
        {
            get { return txtApp.Text; }
            set { txtApp.Text = value; }
        }

        public string AppArgument
        {
            get { return txtArg.Text; }
            set { txtArg.Text = value; }
        }

        private void btnSelectApp_Click(object sender, EventArgs e)
        {
            string path = SimpleDialog.OpenFile("Browse", "Programs|*.exe;*.com;*.bat;*.cmd|All Files(*.*)|*.*", ".exe", true, Application.StartupPath);
            if (!String.IsNullOrEmpty(path)) AppPath = path;
        }

    }//end of class
}
